package com.sun.dream.fish.util;

import com.sun.dream.fish.vo.ResultVO;

public class ResponseUtil {

    public static <T> ResultVO<T> ok(T data, String message) {
        return new ResultVO<>(data, 0, message);
    }

    public static <T> ResultVO<T> ok() {
        return new ResultVO<>(null, 0);
    }

    public static <T> ResultVO<T> ok(T data) {
        return new ResultVO<>(data, 0);
    }

    public static <T> ResultVO<T> ok(String message) {
        return new ResultVO<>(null, 0, message);
    }

    public static <T> ResultVO<T> fail(T data, String message) {
        return new ResultVO<>(data, 500, message);
    }

    public static <T> ResultVO<T> fail(String message) {
        return new ResultVO<>(null, 500, message);
    }

    public static <T> ResultVO<T> fail(int code) {
        return new ResultVO<>(null, code);
    }

    public static <T> ResultVO<T> fail(int code, String message) {
        return new ResultVO<>(null, code, message);
    }

    public static <T> ResultVO<T> fail() {
        return new ResultVO<>(null, 500);
    }
}
